package com.why.zing.payapi.controller;

import com.why.zing.common.domain.ZingResult;
import com.why.zing.payapi.model.ClosePayOrderRequest;
import com.why.zing.payapi.service.CallBackService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.Map;

@Api(tags = "回调")
@RestController
@RequestMapping(value = "/callBack")
public class CallBackController {

    @Autowired
    private CallBackService callBackService;


    @ApiOperation("接收支付宝回调接口")
    @PostMapping(value = "/aliPay")
    public String aliPayCallBack(@RequestParam Map<String,String> aliPayCallBackMap){
        return callBackService.aliCallBack(aliPayCallBackMap);
    }


    @ApiOperation("超时关闭订单")
    @PostMapping(value = "/closePayOrder")
    public ZingResult closeOrder(@RequestBody ClosePayOrderRequest closePayOrderRequest){
        return callBackService.closePayOrder(closePayOrderRequest);
    }
}
